package matImpl;

import test.RunningTime;
import uci.rt.ccr.engine.matrix.Mat;

public class VarianceTest
{

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception
	{
		determinantTest();
		/*int o=3;
		int rows=o;
		int cols=rows;
		int i=2;
		double[][] data = new double[rows][cols];
		for(int r=0;r<rows;r++){
			for(int c=0;c<cols;c++){
				data[r][c]=Math.ceil(Math.random()*20-4.5);
			}
		}
		data[0][0]=4;
		data[0][1]=2;
		data[0][2]=3;
		data[1][0]=-3;
		data[1][1]=-2;
		data[1][2]=-1;
		data[2][0]=-3;
		data[2][1]=15;
		data[2][2]=6;/**

		Mat a = new Mat(data);
		System.out.println("Det = "+a.det());
		//Mat cov =a.cov();
		a.print();
		//cov.print();
		Mat c= a.inverseMatrix();
		c.print();
		Mat d = c.multiply(a);
		d.print();*/
	}

	private static void determinantTest() throws Exception
	{
		for (int o=4;o<5;o++){
				int rows=o;
				int cols=rows;
				int i=2;
				double[][] data = new double[rows][cols];
				for(int r=0;r<rows;r++){
					for(int c=0;c<cols;c++){
						data[r][c]=Math.ceil(Math.random()*3);
					}
				}
				data[0]=new double[]{2,2,1,1};
				data[1]=new double[]{3,3,3,2};
				data[2]=new double[]{3,1,3,2};
				data[3]=new double[]{3,2,3,2};
		
				Mat a = new Mat(data);
				RunningTime rt = new RunningTime();
				rt.start();
				double d=a.det();
				rt.stop();
				a.print();
				System.out.println("Det  "+o+ " millisec:"+(rt.getElapsedMillisecs())/100+" det="+d);
			}
		
	}
	

}
